home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
FM Towns: Free Software Collection 6
/
FM Towns Free Software Collection 6.iso
/
ms_dos
/
txf
/
src
/
txfswchk.c
< prev
Wrap
C/C++ Source or Header
|
1993-07-08
|
4KB
|
238 lines
/***************
*
* g:\exe\txf\src\txfswchk.c
*/
#include "txf.h"
char *tkl, *tkf, *tkq;
void case_k(char c, char *str)
{
if (c == 'f')
kf = ktrans(str);
if (c == 'l')
kl=ktrans(str);
if (c =='q')
kq = ktrans(str);
tkl = kl;
tkf = kf;
tkq = kq;
}
void case_r(char c)
{
if (c == NUL) {
retflg = 1;
}
else if (c == 'z') {
removeeofflg = 1;
}
else if (c =='b') {
removebakfile = 1;
}
}
void case_e(char c)
{
if (c == 'x') format = 0;
#if !TXFL
if (c == 'p') useoldex = 0;
if (c == 's') useoldex = 1;
#endif
}
void swchk(int count, char **val)
{
int i;
for (i = 0; val[i] != NULL; i++) {
if (val[i][0] == '-') {
val[i][1] = tolower(val[i][1]);
val[i][2] = tolower(val[i][2]);
switch(val[i][1]) {
case 'i':
if (val[i][2] == NUL) {
if ((val[i+1][0] != '-') && (val[i+1][0] != '@')) {
strcpy(inputfile, val[i+1]);
gftime(inputfile, ftime);
}
else {
i--;
}
}
if (val[i][2] == 'o') {
strcpy(wcfile, val[i+1]);
}
break;
case 'o':
if ((val[i+1][0] != '-') && (val[i+1][0] != '@')) {
strcpy(outputfile, val[i+1]);
}
else {
i--;
}
break;
case 'c':
if ((val[i+1][0] != '-') && (val[i+1][0] != '@')) {
cent = atoi(val[i+1]);
}
else {
cent = 60;
i--;
}
break;
case 'l':
if (strlen(val[i]) == 2) {
if ((val[i+1][0] != '-') && (val[i+1][0] != '@')) {
maxc = atoi(val[i+1]);
}
else {
i--;
}
}
else if (val[i][2] == 'c') {
lcxdriver(&val[i+1]);
}
#if !TXFL
else if (val[i][2] == 'o') {
logdriver(&val[i+1]);
}
#endif
break;
case 'b':
if ((val[i+1][0] != '-') && (val[i+1][0] != '@')) {
base = atoi(val[i+1]);
}
else {
base = 0;
i--;
}
break;
case 'm':
if ((val[i][2] == 'r') && (val[i+1][0] != '-') &&
(val[i+1][0] != '@')) {
right = atoi(val[i+1]);
}
else if ((val[i][2] == 'l') && (val[i+1][0] != '-') &&
(val[i+1][0] != '@')) {
left = atoi(val[i+1]);
}
else {
i--;
}
break;
case 'k':
case_k(val[i][2], val[i+1]);
break;
case 's':
sep = val[i+1][0];
break;
case 't':
if (val[i+1][0] != '-' && val[i+1][0] != '@') {
tabsize = atoi(val[i+1]);
}
else {
i--;
}
break;
case 'v':
viewmode = 1;
if (val[i][2] != NUL) {
viewmode = atoi(&val[i][2]);
i--;
}
else {
if ((val[i+1][0] != '-') && (val[i+1][0] != '@')
&& (val[i+1][0] != NUL)) {
viewmode = atoi(val[i+1]);
}
else {
i--;
}
}
break;
case 'r':
case_r(val[i][2]);
i--;
break;
case 'n':
if (val[i][2] == NUL) {
format = 0;
i--;
}
#if !TXFL
else if (val[i][2] == 'p') {
npcutdriver(&val[i+1]);
}
#endif
break;
case 'f':
format = 1;
i--;
break;
case 'x':
tabx = 1;
i--;
break;
case 'q':
quoteflg = 1;
i--;
break;
case 'a':
init_allswitch();
i--;
break;
case 'p':
setline = 2;
i--;
break;
case 'd':
if (val[i][2] == NUL) {
if ((val[i+1][0] != '-') && (val[i+1][0] != '@') &&
(val[i+1][0] != NUL)) {
strncpy(tfile[0], val[i+1], 64);
}
else{
i--;
}
}
break;
case 'e':
if (val[i][2] == NUL) {
if (exflg > EX_MAX) errexit("too many exchange block");
exold[exflg] = &val[i+1][0];
if ((val[i+2][0] != '-') && (val[i+2][0] != '@')) {
exnew[exflg] = val[i+2];
i++;
}
exflg += 1;
}
else {
case_e(val[i][2]);
}
break;
#if !NOHELP
case '?':
case 'h':
credit(basedir);
#endif
default:
fprintf(stderr, "Error:invailed parameter'%s'\n", val[i]);
#if !NOHELP
credit(basedir);
#endif
/* exit(1); */
}
i++;
}
else if (val[i][0] == '@') {
read_commandfile(&val[i][1]);
}
else if (*inputfile == NUL) {
strcpy(inputfile, val[i]);
}
}
kl=tkl;
kf=tkf;
kq=tkq;
}